<template>
<div>

	<!-- <el-alert 
	v-if="!productDetail.bookingnotes || productDetail.bookingnotes == ''"
	title="请填写预定须知" class="mb20" type="warning"></el-alert>
 -->

<el-card class="box-card">
<div slot="header" class="clearfix">
    <span>产品列表</span>
</div>

	<el-tabs type="card" v-if="productDetail.id">

		<el-button class="golist" size="small" @click="golist">返回列表</el-button>

	  	<el-tab-pane>
		    <span slot="label"><i class="el-icon-date"></i> 电子票信息</span>
			<el-tabs >
			    <el-tab-pane label="基本信息">
			    	<ticketbase
			    	v-bind:productDetail="productDetail"
			    	 ></ticketbase>
			    </el-tab-pane>

			    <el-tab-pane label="产品图片">
			    	<toppic 
			    	v-bind:productDetail="productDetail"
			    	></toppic>
			    </el-tab-pane>
			    
			    <el-tab-pane label="产品详情">
			    	<productText 
			    	v-bind:productDetail="productDetail"
			    	></productText>
			    </el-tab-pane>

			    <!-- <el-tab-pane label="类别/栏目">
			    	<other 
			    	v-bind:productDetail="productDetail"
			    	></other>
			    </el-tab-pane>
 -->
			</el-tabs>
		</el-tab-pane>

		<el-tab-pane >
			<span slot="label"><i class="el-icon-setting"></i> 型号信息</span>
			<model 
	    	v-bind:productDetail="productDetail"
	    	v-on:reload="getProductDetail"
			></model>
		</el-tab-pane>
		
		<el-tab-pane >
			<span slot="label"><i class="el-icon-news"></i> 票种信息</span>
			<ticket 
	    	v-bind:productDetail="productDetail"
	    	v-on:reload="getProductDetail"
			></ticket>
		</el-tab-pane>
		
		<el-tab-pane >
			<span slot="label"><i class="el-icon-share"></i> 推广信息</span>
			<el-tabs >
			    <el-tab-pane label="海报">
			    	<poster 
			    	v-bind:productDetail="productDetail">
			    	</poster>
			    </el-tab-pane>
			    <el-tab-pane label="推广物料">
			    	<materials
			    	v-bind:productDetail="productDetail">
			    	</materials>
			    </el-tab-pane>
			</el-tabs>
		</el-tab-pane>


		

	</el-tabs>
</el-card>
</div>
  		
</template>

<script>

import { mapGetters } from 'vuex'
import ticketbase from './children/ticket_base'
import toppic from './children/toppic'
import productText from './children/text'
import model from './children/model'
import ticket from './children/ticket'
import poster from './children/poster'
import materials from './children/materials'
import pricecalendar from './children/pricecalendar'
import other from './children/other'

export default {
	name: 'productDetail',
	data () {
		return {
			productDetail : {},
		}
	},

	components: {
		ticketbase,
		toppic,
		productText,
		model,
		ticket,
		poster,
		materials,
		pricecalendar,
		other,
	},

	computed : {
		...mapGetters([
			//'productDetail',
		]),
	},

	methods : {
		getProductDetail () {
			let para = {
				id :  this.$route.params.id,
				fun : 'productDetail',
				st : 'setProductDetail',
				cb : res => {
					this.productDetail = res;
					console.log(res);
					if(this.productDetail.sale_belong == 'weshop_royaloc'){
						for(var i = 0; i < this.productDetail.attrlist.length; i++){
							var tmp = this.productDetail.attrlist[i];
							if(tmp['sysaffirm_target_goods_child_flag'] == undefined){
								tmp['sysaffirm_target_goods_child_flag'] = '0';
							}
						}
					}
				},
				err : res => {
					
				}
			}
			this.$store.dispatch('query', para);

			// this.$store.dispatch('getProductDetail', {
			// 	id : this.$route.params.id,
			// });
		},

		golist () {
			this.$router.push({name : 'app.newproductlist'});
		},


	},

	watch:{
	    
	},

	mounted () {
		this.getProductDetail();
	},

}
</script>

<style scoped>
.golist {
	position: absolute;
    right: 16px;
    top: 0px;
    z-index: 998;
}
</style>
